<template lang="pug">
  el-form-item(v-if='!scope' :prop="config.propertyName" :class="config.label?'':'form-label-hidden'"  :label="config.label" :rules="rules")
    el-input(@blur="blur" @input="input" @focus="focus" @keydown.native="keydown" @keyup.native="keyup"  @click.native="readonly && $event.target.blur()" @touchstart.native="readonly && $event.target.blur()" :placeholder="readonly?' ':config.placeholder"     ref="input"   :type="config.inputType" :rows="3" v-model="rootForm.properties[config.propertyName]" :title="rootForm.properties[config.propertyName]" :readonly='readonly')
      template(slot="append" v-if="config.suffix") {{config.suffix}}
  //- el-form-item(v-else :prop="config.propertyName" label-width="0px" :rules="rules")
  div(v-else)
    requiredLabel.scope-label(:required="required" :label="config.label")
    el-input(:class="{'scope-success':flag&&!scopeErrorMessage,'scope-normal':!flag}" @blur="blur"  @input="input" @focus="focus" @keydown.native="keydown" @keyup.native="keyup" @click.native="readonly && $event.target.blur()" @touchstart.native="readonly && $event.target.blur()" :placeholder="readonly?' ':config.placeholder"     ref="input"   :type="config.inputType" :rows="3" v-model="scope[config.propertyName]" :title="scope[config.propertyName]" :readonly='readonly')
      template(slot="append" v-if="config.suffix") {{config.suffix}}
    .scope-error-message {{scopeErrorMessage}}
</template>
<script>
import requiredLabel from '../../../../components/requiredLabel'
import normalRenderCommon from '../common/normalRenderCommon'

export default {
  components: { requiredLabel },
  mixins: [normalRenderCommon],
  methods: {
    blur() {
      this.validate()
      return this.config.blurCb && this.getParsedFn('blurCb')()
      // return this.config.blurCb && !!(new Function('__properties', '__row', 'with(__properties) {return (' + this.config.blurCb + ')() }'))(this.rootForm.properties, this.scope)
    },
    input(value) {
      this.validate()
      return this.config.inputCb && this.getParsedFn('inputCb')(value)
    }
  },
}
</script>
